package cn.sytton.taffe.auth.controller;

import cn.sytton.taffe.auth.service.ISSOService;
import cn.sytton.taffe.framework.base.controller.BaseController;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@Tag(name = "登录")
@RestController
@RequestMapping("/auth/sso")
public class SSOController extends BaseController {

    @Resource
    private ISSOService ssoService;

    @Operation(summary = "验证authorizationCode,并返回token")
    @PostMapping("/verify-code")
    public String verifyCode(@RequestBody Map<String, String> body) {
        return ssoService.verifyCode(body.get("code"), body.get("redirectUri"));
    }

}
